#include "goodsbuyinlogwindow.h"
#include "ui_goodsbuyinlogwindow.h"
#include "goodsoperatewindow.h"
#define LOGPATH "./data/purchingLog.txt"
#include<QFile>
goodsBuyinLogWindow::goodsBuyinLogWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::goodsBuyinLogWindow)
{
    ui->setupUi(this);
    QFile *log=new QFile(LOGPATH);

    if (!log->open(QIODevice::ReadOnly | QIODevice::Text))
             return;

         while (!log->atEnd()) {
             QByteArray line = log->readLine();
             ui->textBrowser->append(QString(line));
         }
}

goodsBuyinLogWindow::~goodsBuyinLogWindow()
{
    delete ui;
}

void goodsBuyinLogWindow::on_returnButton_clicked()
{
    QObject* before=this->parentWidget();
    goodsOperateWindow* p1=dynamic_cast<goodsOperateWindow*>(before);
    p1->show();
    this->hide();
}
